package com.jdk.demo.fileChannel;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.nio.channels.FileChannel;

public class FileChannelTest2 {

	public static void main(String[] args) throws Exception {
		File file = new File("E:/zsl/temp2.txt");
		File bak = new File("E:/zsl/temp3.txt");
		FileInputStream fileInputStream = new FileInputStream(file);
		FileOutputStream bakOutputStream = new FileOutputStream(bak);
		FileChannel fileChannel = fileInputStream.getChannel();
		FileChannel bakChannel = bakOutputStream.getChannel();

		fileChannel.transferTo(0, fileChannel.size(), bakChannel);

		fileChannel.close();
		bakChannel.close();
	}

}
